package parser;

import java.util.ArrayList;
import java.util.List;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import es.deusto.ingenieria.is.search.formulation.State;
import es.deusto.ingenieria.is.search.xml.StateXMLReader;

public class FormulaReader extends StateXMLReader {

	private int anyo;

	public FormulaReader(String fileXML) {
		super(fileXML);
	}

	@Override
	public State getState() {
		return null;
	}

	public int getAnyo(){
		return anyo;
	}

	public String getResult() {
		return result;
	}

	@Override
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
		if (operands == null) {
			operands = new ArrayList<String>();
		}
		try {
			if (qName.equalsIgnoreCase("aws:ob")){
				if (qName.equalsIgnoreCase("aws:ob-date")){
					if(qName.equalsIgnoreCase("aws:year")){
						anyo = Integer.parseInt(attributes.getValue("year"));
						System.out.println(anyo);
					}
				}
			}
			
		}
		catch (Exception ex) {
			System.out.println(this.getClass().getName() + ".startElement(): " + ex);
		}
	}

	

}
